#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+10;
int ans1,ans2;
int T;
int n,m,L,V;
int road[MAXN];
bool camera[MAXN];
struct car{
    int d,v,a;
    bool limit=0;
}CAR[MAXN];
void check1(){
    for(int i=1;i<=n;i++){
        if(CAR[i].a<=0&&CAR[i].v<=V)continue;
        for(int j=1;j<=m;j++){

        }
    }
}
int main(){
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    ios::sync_with_stdio(false);
    cin>>T;
    while(T--){
        memset(camera,0,sizeof(camera));
        memset(road,0,sizeof(road));
        cin>>n>>m>>L>>V;
        for(int i=1;i<=n;i++){
            cin>>CAR[i].d>>CAR[i].v>>CAR[i].a;
        }
        for(int i=1;i<=m;i++){
            int ii;
            cin>>ii;
            camera[i]=ii;
        }
        check1();
        //check2();
        cout<<ans1<<endl;
        cout<<ans2<<endl;
    }
    return 0;
}
